//===================================================================================
// $$
//
// Coder: Code Milker v1.0
// 0 - upper
// 1 - lower
//===================================================================================


namespace App.Domain.Handlers {
    using System;
    using App.Data;
    using App.Domain.Contracts;

    public class DeleteNews {
        private readonly INewsRepository _NewsRepository;

        public DeleteNews(INewsRepository NewsRepository) {
            _NewsRepository = NewsRepository;
        }

        public virtual void Execute(Guid newsId) {
            var NewsToDelete = _NewsRepository.GetNews(newsId);

            if (NewsToDelete != null) {
                _NewsRepository.Delete(newsId);
            }
            else {
                throw new BusinessServicesException("UnableToDeleteVehicleExceptionMessage");
            }
        }
    }
}
